现象
跑Python脚本时出现报错:
EnvironmentError: Multiple devices attached but default android serial not set.
这是由于电脑上链接了多台devices,但是又没有指定默认使用的device导致;
如:1234$ adb devicesList of devices attachedDC886B65deviceDC886B75 device
解决方法:
这种情况一般来说可以用-s指定serial号码即可运行,如:1adb -s DC886B74shell
但是脚本中不方便指定,能否设置一个默认的呢?可以的:
在linux下可以通过命令:1export ANDROID_SERIAL="DC886B75"
来设定默认的serial号码的device;
另:当不想使用此变量时,可以unset ANDROID_SERIAL 来取消变量设置;